<template>
  <div class="hmNavbar">
    <van-nav-bar>
      <template #left>
        <i class="iconfont iconbtn_nav_back myArror" @click="back"></i>
      </template>
      <template #title>
        <h3>{{ title }}</h3>
      </template>
      <template #right>
        <span @click="save" v-if="hasSave">保存</span>
      </template>
    </van-nav-bar>
  </div>
</template>

<script>
export default {
  name: 'hmNavbar',
  props: ['title', 'hasSave'],
  methods: {
    back () {
      // 通知父组件执行代码即可 本次不需要传参
      this.$emit('back')
    },
    save () {
      // 通知父组件执行代码即可 本次不需要传参
      this.$emit('save')
    }
  }
}
</script>

<style lang="less" scoped>
.hmNavbar {
  /deep/ .van-nav-bar__left {
    padding: 0;
  }
  .myArror {
    font-size: 40px;
  }
  h3 {
    margin: 0;
    font-size: 18px;
  }
}
</style>
